<?php
/***************************************************************
*  Copyright notice
*  (c) 2009, jianyuzhu@gmail.com
*  All rights reserved
*  This script is part of the PPEMI project.
***************************************************************/

//
$goto = trim(util_get_param($_REQUEST, 'goto'));

//action
if( $action == 'dologin' ) {
	$username = trim(util_get_param($_REQUEST, 'username', ''));
	$password = trim(util_get_param($_REQUEST, 'password', ''));
	
	//login
	$data_array = array(
				'username' => $username,
				'password' => $password,
				'type' => 'app',
					);
	$result = $userObj->doLogin($data_array);
	if( $result == USER_LOGIN_SUCCESS ) {
		//$feObj->redirect($request_path . '');
		if( $goto ) {
			$feObj->redirect($goto);
		} else {
			$feObj->redirect('app/');
		}
	} else {
		if( $goto ) {
			$url = 'app/login?goto=' . $goto;
		} else {
			$url = 'app/login';
		}
		$feObj->redirect($url, 'Invalid Access');
	}
	//
}

//
echo $feObj->display('pagelayout/apps/pagelayout_app_console_login.tpl');
//
?>